//
//  DetailTopCell.m
//  BMProject
//
//  Created by chris on 16/1/1.
//  Copyright © 2016年 BMProject. All rights reserved.
//

#import "DetailTopCell.h"
#import "DataModel.h"

@implementation DetailTopCell

- (void)awakeFromNib {
    // Initialization code
    self.backgroundColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.94 alpha:1];
    [self clearData];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setStoresListModel:(StoresListModel *)storesListModel {
    _storesListModel = storesListModel;
    self.statusLa.text = [self getSignNameFromid:storesListModel.sign.intValue];
}


- (void)setInfo:(NSDictionary *)info {

    if (!info) {
        return;
    }

    NSDictionary *websiteInfo = info[@"websiteInfo"];
    NSDictionary *sysUnit = info[@"sysUnit"];

    self.BranchLa.text =       [NSString ignoreEmptyStr:sysUnit[@"name"]];;
    self.nameLa.text =         [NSString ignoreEmptyStr:websiteInfo[@"storeName"]];
    self.applicantLa.text =    [NSString ignoreEmptyStr:websiteInfo[@"name"]];
    self.IDLa.text =           [NSString ignoreEmptyStr:websiteInfo[@"idCard"]];
    self.managerNumLa.text =   [NSString ignoreEmptyStr:websiteInfo[@"servicer"]];
    self.addressLa.text =      [NSString ignoreEmptyStr:websiteInfo[@"businessAddress"]];
    self.accountLa.text =      [NSString ignoreEmptyStr:websiteInfo[@"bankAccount"]];
    self.bankLa.text =         [NSString ignoreEmptyStr:websiteInfo[@"bankName"]];
    self.bankAddressLa.text =  [NSString ignoreEmptyStr:websiteInfo[@"businessAddress"]];
    self.phoneNumLa.text =     [NSString ignoreEmptyStr:websiteInfo[@"terminalId"]];
    self.mailboxLa.text =      [NSString ignoreEmptyStr:websiteInfo[@"email"]];
    self.areaLa.text =         [NSString ignoreEmptyStr:info[@"griddingArea"]];
    self.zhihangLabel.text =         [NSString ignoreEmptyStr:info[@"subBank"]];
}

- (void) clearData {
    self.nameLa.text = @"";
    self.applicantLa.text = @"";
    self.IDLa.text = @"";
    self.BranchLa.text = @"";
    self.managerNumLa.text = @"";
    self.addressLa.text = @"";
    self.accountLa.text = @"";
    self.bankLa.text = @"";
    self.bankAddressLa.text = @"";
    self.phoneNumLa.text = @"";
    self.mailboxLa.text = @"";
    self.areaLa.text = @"";
    self.statusLa.text = @"";
}


- (NSString *)getSignNameFromid:(NSInteger)signId {
    // sign==1 待审核  sign==2 渠道经理审核通过  sign==3 渠道经理审核驳回  sign==4  分公司审核通过  sign==5 分公司审核驳回  sign==6 签约完成
    if (signId  == 1) {
        return @"待审核";
    }
    if (signId  == 2) {
        return @"渠道经理审核通过";
    }
    if (signId  == 3) {
        return @"渠道经理审核驳回";
    }
    if (signId  == 4) {
        return @"分公司审核通过";
    }
    if (signId  == 5) {
        return @"分公司审核驳回";
    }
    if (signId  == 6) {
        return @"签约完成";
    }
    return @"";
}


@end
